package com.sskj.cndragon.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.cndragon.http.HttpConfig;
import com.sskj.cndragon.ui.activity.NickNameActivity;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.http.JsonCallBack;


public class NickNameActivityPresenter extends BasePresenter<NickNameActivity> {

    public void editNickName(String id, String nickName) {
        httpService.editNickName(id, nickName)
        .execute(new JsonCallBack<HttpData>() {
            @Override
            public void onSuccess(Response<HttpData> response) {
                HttpData body = response.body();
                ToastUtil.showShort(body.getMsg());
                if (body.getStatus() == HttpConfig.OK) {
                    mView.editTextSuccess(nickName);
                }
            }
        });
    }
}
